1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.PreferencesGroup; 26 27 private import adw.c.functions; 28 public import adw.c.types; 29 private import glib.ConstructionException; 30 private import glib.Str; 31 private import glib.c.functions; 32 private import gobject.ObjectG; 33 private import gtk.AccessibleIF; 34 private import gtk.AccessibleT; 35 private import gtk.BuildableIF; 36 private import gtk.BuildableT; 37 private import gtk.ConstraintTargetIF; 38 private import gtk.ConstraintTargetT; 39 private import gtk.Widget; 40 41 42 /** 43 * A group of preference rows. 44 * 45 * <picture> 46 * <source srcset="preferences-group-dark.png" media="(prefers-color-scheme: dark)"> 47 * <img src="preferences-group.png" alt="preferences-group"> 48 * </picture> 49 * 50 * An `AdwPreferencesGroup` represents a group or tightly related preferences, 51 * which in turn are represented by [class@PreferencesRow]. 52 * 53 * To summarize the role of the preferences it gathers, a group can have both a 54 * title and a description. The title will be used by [class@PreferencesWindow] 55 * to let the user look for a preference. 56 * 57 * ## AdwPreferencesGroup as GtkBuildable 58 * 59 * The `AdwPreferencesGroup` implementation of the [iface@Gtk.Buildable] interface 60 * supports adding [class@PreferencesRow]s to the list by omitting "type". If "type" 61 * is omitted and the widget isn't a [class@PreferencesRow] the child is added to 62 * a box below the list. 63 * 64 * When the "type" attribute of a child is `header-suffix`, the child 65 * is set as the suffix on the end of the title and description. 66 * 67 * ## CSS nodes 68 * 69 * `AdwPreferencesGroup` has a single CSS node with name `preferencesgroup`. 70 * 71 * ## Accessibility 72 * 73 * `AdwPreferencesGroup` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. 74 * 75 * Since: 1.0 76 */ 77 public class PreferencesGroup : Widget 78 { 79 /** the main Gtk struct */ 80 protected AdwPreferencesGroup* adwPreferencesGroup; 81 82 /** Get the main Gtk struct */ 83 public AdwPreferencesGroup* getPreferencesGroupStruct(bool transferOwnership = false) 84 { 85 if (transferOwnership) 86 ownedRef = false; 87 return adwPreferencesGroup; 88 } 89 90 /** the main Gtk struct as a void* */ 91 protected override void* getStruct() 92 { 93 return cast(void*)adwPreferencesGroup; 94 } 95 96 /** 97 * Sets our main struct and passes it to the parent class. 98 */ 99 public this (AdwPreferencesGroup* adwPreferencesGroup, bool ownedRef = false) 100 { 101 this.adwPreferencesGroup = adwPreferencesGroup; 102 super(cast(GtkWidget*)adwPreferencesGroup, ownedRef); 103 } 104 105 106 /** */ 107 public static GType getType() 108 { 109 return adw_preferences_group_get_type(); 110 } 111 112 /** 113 * Creates a new `AdwPreferencesGroup`. 114 * 115 * Returns: the newly created `AdwPreferencesGroup` 116 * 117 * Since: 1.0 118 * 119 * Throws: ConstructionException GTK+ fails to create the object. 120 */ 121 public this() 122 { 123 auto __p = adw_preferences_group_new(); 124 125 if(__p is null) 126 { 127 throw new ConstructionException("null returned by new"); 128 } 129 130 this(cast(AdwPreferencesGroup*) __p); 131 } 132 133 /** 134 * Adds a child to @self. 135 * 136 * Params: 137 * child = the widget to add 138 * 139 * Since: 1.0 140 */ 141 public void add(Widget child) 142 { 143 adw_preferences_group_add(adwPreferencesGroup, (child is null) ? null : child.getWidgetStruct()); 144 } 145 146 /** 147 * Gets the description of @self. 148 * 149 * Returns: the description of @self 150 * 151 * Since: 1.0 152 */ 153 public string getDescription() 154 { 155 return Str.toString(adw_preferences_group_get_description(adwPreferencesGroup)); 156 } 157 158 /** 159 * Gets the suffix for @self's header. 160 * 161 * Returns: the suffix for @self's header. 162 * 163 * Since: 1.1 164 */ 165 public Widget getHeaderSuffix() 166 { 167 auto __p = adw_preferences_group_get_header_suffix(adwPreferencesGroup); 168 169 if(__p is null) 170 { 171 return null; 172 } 173 174 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 175 } 176 177 /** 178 * Gets the title of @self. 179 * 180 * Returns: the title of @self 181 * 182 * Since: 1.0 183 */ 184 public string getTitle() 185 { 186 return Str.toString(adw_preferences_group_get_title(adwPreferencesGroup)); 187 } 188 189 /** 190 * Removes a child from @self. 191 * 192 * Params: 193 * child = the child to remove 194 * 195 * Since: 1.0 196 */ 197 public void remove(Widget child) 198 { 199 adw_preferences_group_remove(adwPreferencesGroup, (child is null) ? null : child.getWidgetStruct()); 200 } 201 202 /** 203 * Sets the description for @self. 204 * 205 * Params: 206 * description = the description 207 * 208 * Since: 1.0 209 */ 210 public void setDescription(string description) 211 { 212 adw_preferences_group_set_description(adwPreferencesGroup, Str.toStringz(description)); 213 } 214 215 /** 216 * Sets the suffix for @self's header. 217 * 218 * Params: 219 * suffix = the suffix to set 220 * 221 * Since: 1.1 222 */ 223 public void setHeaderSuffix(Widget suffix) 224 { 225 adw_preferences_group_set_header_suffix(adwPreferencesGroup, (suffix is null) ? null : suffix.getWidgetStruct()); 226 } 227 228 /** 229 * Sets the title for @self. 230 * 231 * Params: 232 * title = the title 233 * 234 * Since: 1.0 235 */ 236 public void setTitle(string title) 237 { 238 adw_preferences_group_set_title(adwPreferencesGroup, Str.toStringz(title)); 239 } 240 }